﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;
using System.IO;
using System.Xml;

namespace HelperTool
{
    public partial class HelperTool : Form
    {
        public HelperTool()
        {
            InitializeComponent();
        }

        private void DoAction_Click(object sender, EventArgs e)
        {
            string output = null ;
            switch (ActionComboBox.SelectedItem as string)
            {
                case ClassSkillConversion.ActionName: 
                    output = ClassSkillConversion.DoStuff(InputTextBox.Text); break;
                case ClassConversion.ActionName:
                    output = ClassConversion.DoStuff(InputTextBox.Text); break;
                
            }

            XmlOutTextBox.Text = output;
        }

        private void HelperTool_Load(object sender, EventArgs e)
        {
            ActionComboBox.Items.Add(ClassSkillConversion.ActionName);
        }

        private void SaveXmlButton_Click(object sender, EventArgs e)
        {
            try
            {
                StreamWriter writer = new StreamWriter(XmlSavePathTextBox.Text);
                writer.Write(XmlOutTextBox.Text);
                writer.Flush();
                writer.Close();
            }
            catch (Exception exception)
            {
                MessageBox.Show(exception.Message);
            }
        }
    }
}
